import sys

from PySide6 import QtWidgets
from PySide6.QtCore import QSize
from PySide6.QtGui import QGuiApplication
from PySide6.QtWidgets import QSizePolicy, QWidget, QPushButton

from src.ui.motor import Motor


class MotorUI(QtWidgets.QMainWindow):
    """
    电机上位机UI页面
    """

    def __init__(self):
        super().__init__()
        self.setObjectName("MotorControlMainWindow")
        self.size_policy = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
        # 获取桌面尺寸
        desktop = QGuiApplication.primaryScreen().geometry()
        print(f"Desktop width: {desktop.width()} height: {desktop.height()}")
        # 创建一个中心组件
        # self.central_widget = QWidget(self)
        # self.central_widget.setSizePolicy(self.size_policy)
        # central_window_size = QSize(desktop.width(), desktop.height())
        # self.resize(central_window_size)

        # # 设置中心控件
        # self.setCentralWidget(self.central_widget)

    def init_ui(self):
        """
        创建UI页面
        :return:
        """
        # # 启动
        # start = QPushButton(self)
        # start.setText("开始")
        motor = Motor()
        motor.setupUi(self)


if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    window = MotorUI()

    motor_ui = MotorUI()
    motor_ui.init_ui()
    window.show()

    app.exec()
